import json from '@rollup/plugin-json'
import terser from '@rollup/plugin-terser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

export default [
	{
		input: './src/main/javascript/tutool/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es',
				sourcemap: true,
				format: 'es'
			},
			{
				name: 'tutool',
				dir: 'dist/cjs',
				sourcemap: true,
				format: 'cjs'
			},
			{
				name: 'tutool',
				dir: 'dist/umd',
				sourcemap: true,
				format: 'umd'
			},
			{
				name: 'tutool',
				dir: 'dist/system',
				sourcemap: true,
				format: 'system'
			},
			{
				name: 'tutool',
				dir: 'dist/iife',
				sourcemap: true,
				format: 'iife'
			},
			{
				name: 'tutool',
				format: 'iife',
				file: 'dist/iife/index.min.js',
				sourcemap: true,
				plugins: [terser()]
			},
			{
				name: 'tutool',
				dir: 'dist/amd',
				format: 'amd',
				sourcemap: true,
				amd: {
					id: 'tutool'
				}
			},
			{
				name: 'tutool',
				format: 'amd',
				file: 'dist/amd/index.min.js',
				plugins: [terser()],
				sourcemap: true,
				amd: {
					id: 'tutool'
				}
			},
		],
		plugins: [json()]
	},
	{
		input: './src/main/javascript/tutool/util/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es/util',
				sourcemap: true,
				format: 'es'
			},
		],
	},
	{
		input: './src/main/javascript/tutool/object/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es/object',
				sourcemap: true,
				format: 'es'
			},
		],
	},
	{
		input: './src/main/javascript/tutool/core/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es/core',
				sourcemap: true,
				format: 'es'
			},
		],
	},
	{
		input: './src/main/javascript/tutool/cache/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es/cache',
				sourcemap: true,
				format: 'es'
			},
		],
	},
	{
		input: './src/main/javascript/tutool/console/index.js',
		output: [
			{
				name: 'tutool',
				dir: 'dist/es/console',
				sourcemap: true,
				format: 'es'
			},
		],
	},
]